package it.polimi.traveldream.ejbclient.dtos;

import it.polimi.traveldream.utils.enums.BaseProductType;

import java.math.BigDecimal;
import java.util.Date;

import javax.validation.constraints.Min;

public class HotelDTO extends BaseProductDTO{
	private static final long serialVersionUID = 1178951216568392616L;
	private final BaseProductType type = BaseProductType.HOTEL;
	private String address;
	private String name;
	private int rating;
	
	public HotelDTO() {
		super();
	}

	public HotelDTO(int id, String description, Date endTrip, int maxAvailability,
			boolean overpast, BigDecimal price, int reservations, Date startTrip,
			String address, String name, int rating) {
		super(id, description, endTrip, maxAvailability, overpast, price, reservations, startTrip);
		this.address = address;
		this.name = name;
		this.rating = rating;
	}


	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Min(value = 0, message = "Invalid rating")
	public int getRating() {
		return rating;
	}

	public void setRating(int rating) {
		this.rating = rating;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + ((type == null) ? 0 : type.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		HotelDTO other = (HotelDTO) obj;
		if (type != other.type)
			return false;
		return true;
	}
	
}
